package com.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dao.EmpDao;
import com.pojo.Emp;
import com.service.IEmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class EmpServiceImpl implements IEmpService {

    @Autowired
    private EmpDao empDao;

    @Override
    public IPage searchEmp(int page, int limit, Map m) {
        Page p=new Page(page,limit);
        IPage result=empDao.searchEmpWithDep(p,m);

        return result;
    }

    @Override
    public int updatesex(Integer empId, Integer sex) {
        Integer nannv=0;
        if (sex==0){
            nannv=1;
        }
        else{
            nannv=0;
        }
        Emp emp=new Emp();
        emp.setSex(nannv);
        emp.setEmpId(empId);
        int i=empDao.updateById(emp);


        return i;

    }
}
